<div class="row">
	<div class="panel callout"><h6>Student Grades</h6></div>
	<?php 
	if(!empty($student)):
		$this->load->view('profile/_profile_links');
	endif;
	
	$this->load->view('layouts/student_profile_head');
	?>
<?php echo form_fieldset('Grades of ' . strtoupper($student->lastname) . ', ' . ucfirst($student->firstname));?>
	

	<table class="data-table">
			<thead class="tabular-head">
			<tr>
				<th>Subject Code</th>
				<? if(!empty($grading_periods)) :?>
				<? foreach($grading_periods as $row) :?>
				<th><?= $row->gp_desc ;?></th>
				<? endforeach ;?>
				<? endif ;?>
			</tr>
			</thead>
			<tbody class="tabular">
      <? if(!empty($student_grades)) :?>
      <? foreach($student_grades as $row) :?>
			    <tr>
				    <td><?= $row->subj_code ;?></td>
				    <? foreach($grades as $r) :?>
				    <? if($r->subject_id == $row->subj_id) :?>
				    <td><a href="<?= site_url('profile/edit_student_grade/'.$r->id) ;?>"><?=  $r->value;?></a><br /><?= $r->remarks ;?></td>
				    <? endif ;?>
				    <? endforeach ;?>
			    </tr>
			<? endforeach ;?>
      <? else: ?>
			    <tr>
				    <th>-- No Grades --</th>
			    </tr>
      <? endif;?>
      </tbody>
  </table>
<?php echo form_fieldset_close();?>
</div>
